package com.atguigu.tingshu.album.client;

import com.atguigu.tingshu.album.mapper.BaseCategoryViewMapper;
import com.atguigu.tingshu.album.service.BaseCategoryService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.album.BaseCategory1;
import com.atguigu.tingshu.model.album.BaseCategory3;
import com.atguigu.tingshu.model.album.BaseCategoryView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName: CategoryClientController
 * Package: com.atguigu.tingshu.album.client
 * Description:分类的内部调用控制层
 */
@RestController
@RequestMapping("/client/album/category")
public class CategoryClientController {
    @Autowired
    private BaseCategoryService baseCategoryService;

    /**
     * 根据三级分类id获取一级分类,二级分类,三级分类
     * @param category3Id
     * @return
     */
    @GetMapping("/getBaseCategoryView/{category3Id}")
    public BaseCategoryView getBaseCategoryView(@PathVariable(value = "category3Id")Long category3Id) {
        return baseCategoryService.getBaseCategoryView(category3Id);
    }
    /**
     * 查询置顶前七的三级分类
     * @param category1Id
     * @return
     */
    @GetMapping("/findTopBaseCategory3/{category1Id}")
    public List<BaseCategory3> findTopBaseCategory3(@PathVariable(value = "category1Id") Long category1Id){
        return baseCategoryService.findTopBaseCategory3(category1Id);
    }

}
